<%@ page import="service.serviceimpl.ServiceUserImpl" %>
<%@ page import="entity.Userinfo" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        form{
            display: block;
            width: 400px;
            margin: auto;
        }
    </style>
</head>
<body>
<%--把中转页传入id找出对应的集合数据绑上去，在带回去在修改id用2次在这里--%>
<%  ServiceUserImpl serviceUser = new ServiceUserImpl();
    int id= Integer.parseInt(request.getParameter("id"));
    List<Userinfo> userinfos = serviceUser.executeQuery("select  * from userinfo where id=?", id);
%>
<form method="get" action="controller.jsp">
    <%--    隐藏域--%>
    <input type="hidden" name="op" value="update2">
    <input type="hidden" name="id" value="<%=id%>">
    <table border="4">
        <tr>
            <th>修改人员</th>
        </tr>
        <tr>
            <th>姓名</th>
            <th> <input type="text" value="<%=userinfos.get(0).getName()%>" name="name"> </th>
        </tr>
        <tr>
            <%--            因为默认k-v 只要name -value--%>
            <th>性别</th>
            <th> <input type="radio" <%=userinfos.get(0).getSex()==1?"checked":""%> name="sex" value="1">男
                <input type="radio" <%=userinfos.get(0).getSex()==2?"checked":""%> name="sex" value="2">女</th>
        </tr>
        <tr>
            <th>部门</th>
            <th>
                <select name="dept">
                    <option <%=userinfos.get(0).getDept().equals("总裁")?"selected":""%> value="总裁">总裁</option>
                    <option <%=userinfos.get(0).getDept().equals("经理")?"selected":""%> value="经理">经理</option>
                    <option <%=userinfos.get(0).getDept().equals("前台")?"selected":""%> value="前台">前台</option>
                </select>
            </th>
        </tr>
        <tr>
            <th><input type="submit" value="提交"></th>

        </tr>
    </table>

</form>
</body>
</html>
